package com.campus.common.vo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

// 课程类（基础课程信息 + 组合多个班级）
public class Course implements Serializable {
    private String courseId;      // 课程编号
    private String courseName;    // 课程名称
    private int credit;           // 学分
    private String department;    // ⭐ 开课学院

    // 组合关系：课程包含多个班级
    private List<Classroom> classrooms;

    // 无参构造
    public Course() {
        this.courseId = "";
        this.courseName = "";
        this.credit = 0;
        this.department = "";  // 默认空
        this.classrooms = new ArrayList<>();
    }

    // 全参构造
    public Course(String courseId, String courseName, int credit, String department) {
        this.courseId = courseId;
        this.courseName = courseName;
        this.credit = credit;
        this.department = department;
        this.classrooms = new ArrayList<>();
    }

    // 添加班级
    public void addClassroom(Classroom classroom) {
        classrooms.add(classroom);
    }

    // 设置班级列表
    public void setClassrooms(List<Classroom> classrooms) {
        this.classrooms = classrooms;
    }

    // Getter / Setter
    public String getCourseId() { return courseId; }
    public void setCourseId(String courseId) { this.courseId = courseId; }

    public String getCourseName() { return courseName; }
    public void setCourseName(String courseName) { this.courseName = courseName; }

    public int getCredit() { return credit; }
    public void setCredit(int credit) { this.credit = credit; }

    public String getDepartment() { return department; }
    public void setDepartment(String department) { this.department = department; }

    public List<Classroom> getClassrooms() { return classrooms; }
}
